package com.gec.hawaste.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.hawaste.entity.WorkOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gec.hawaste.vo.ExamineDo;
import com.gec.hawaste.vo.WorkOrderDo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author chenxys
 * @since 2022-07-01
 */
public interface WorkOrderMapper extends BaseMapper<WorkOrder> {
    @Select(
            "SELECT" +
            "   wo.*," +
            "   su.name user_name," +
            "   so.name office_name," +
            "   su1.name transport_name," +
            "   su2.name recipient_name" +
            "   FROM" +
            "   work_order wo" +
            "   LEFT JOIN sys_user su ON wo.create_user_id = su.id" +
            "   LEFT JOIN sys_office so ON su.office_id = so.id" +
            "   LEFT JOIN sys_user su1 ON wo.transport_user_id = su1.id" +
            "   LEFT JOIN sys_user su2 ON wo.recipient_user_id = su2.id ${ew.customSqlSegment}"
    )
    IPage<WorkOrderDo> selectByCondition(IPage<WorkOrderDo> page, @Param("ew") Wrapper ew);
}
